package com.abbcc.module.admin;

import java.io.File;
import java.io.FileOutputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;

import com.abbcc.action.BaseAction;
import com.abbcc.common.CommonConst;
import com.abbcc.common.PaginationSupport;
import com.abbcc.models.TdClient;
import com.abbcc.models.TdData;
import com.abbcc.models.TdProduct;
import com.abbcc.models.TdRecycle;
import com.abbcc.service.ProductService;
import com.abbcc.util.DateUtil;
import com.abbcc.util.ObjectUtil;
import com.abbcc.util.StringUtil;

public class ProductAction extends BaseAction<TdProduct> {
	@Autowired
	private ProductService productService;
	public String isAgain;
	public String dd1;
	public String dd2;
	public String proType;
	public String s_time;
	public String searchKey;
	public String order_type;
	public String isMarked;
	private int userId;
	public String islist2;
	public String pageType;
	private String lsqcName;
	public String zplldbs;

	public String list() {
		//if (StringUtil.isNotBlank(islist2) && islist2.equals("list2")) {
			pageSize = 100;
			startIndex = (page - 1) * pageSize;
		//}
		DetachedCriteria dc = DetachedCriteria.forClass(entityClass);
		if (StringUtil.isNotBlank(searchKey)) {
			dc.add(Restrictions.or(
					Restrictions.like("name", searchKey, MatchMode.ANYWHERE),
					Restrictions.or(Restrictions.like("client", searchKey,
							MatchMode.ANYWHERE), Restrictions.like("pnumber",
							searchKey, MatchMode.ANYWHERE))
					));
		}
		if(StringUtil.isNotBlank(lsqcName)){
			if(lsqcName.indexOf("栏")>-1)
				dc.add(Restrictions.or(Restrictions.like("lsqc", lsqcName, MatchMode.ANYWHERE), Restrictions.isNull("lsqc")));
			else
				dc.add(Restrictions.like("lsqc", lsqcName, MatchMode.ANYWHERE));
			
		}
		if(StringUtil.isNotBlank(entity.getName())){
			dc.add(Restrictions.eq("name", entity.getName()));
		}
		if (StringUtil.isNotBlank(proType) && proType.equals("1")) {
			dc.add(Restrictions.between("deliveryTime",
					DateUtil.getDateStart(new Date()),
					DateUtil.getDateEnd(new Date())));
		}
		if (StringUtil.isNotBlank(proType) && proType.equals("3")) {
			dc.add(Restrictions.between("deliveryTime",
					DateUtil.getDateEnd(new Date()),
					DateUtil.getDateAfter(new Date(), 3)));
		}
		if (StringUtil.isNotBlank(dd1) && StringUtil.isNotBlank(dd2)) {
			
			dc.add(Restrictions.between(entity.getPace().equals("发货")?"fhTime":s_time, DateUtil.strToDate(dd1),
					DateUtil.strToDate(dd2)));
		} else if (StringUtil.isNotBlank(dd1)) {
			dc.add(Restrictions.between(entity.getPace().equals("发货")?"fhTime":s_time, DateUtil.strToDate(dd1),
					new Date()));
		} else if (StringUtil.isNotBlank(dd2)) {
			dc.add(Restrictions.between(entity.getPace().equals("发货")?"fhTime":s_time,
					DateUtil.getDateStart(DateUtil.strToDate(dd2)),
					DateUtil.getDateEnd(DateUtil.strToDate(dd2))));
		} else {

		}
		if(StringUtil.isNotBlank(entity.getPace())){
			dc.add(Restrictions.eq("pace", entity.getPace()));
		}
		if (StringUtil.isNotBlank(islist2) && islist2.equals("list2")) {
			String[] names = { "单门", "子母", "对开", "四开", "四开子母" };
			dc.add(Restrictions.in("name", names));
		}
		if (StringUtil.isNotBlank(isMarked)) {
			if (isMarked.equals("1")) {
				dc.add(Restrictions.eq("marked", "1"));
			}
			if (isMarked.equals("2")) {
				dc.add(Restrictions.or(Restrictions.isNull("marked"),
						Restrictions.eq("marked", "0")));
			}
		}
		if (StringUtil.isNotBlank(order_type)) {
			if (order_type.equals("addTimedesc"))
				dc.addOrder(Order.asc("addTime"));
			if (order_type.equals("bhasc"))
				dc.addOrder(Order.asc("pnumber"));
			if (order_type.equals("bhdesc"))
				dc.addOrder(Order.desc("pnumber"));
			if (order_type.equals("mcasc"))
				dc.addOrder(Order.asc("name"));
			if (order_type.equals("mcasc"))
				dc.addOrder(Order.desc("name"));
			if (order_type.equals("khasc"))
				dc.addOrder(Order.asc("client"));
			if (order_type.equals("khdesc"))
				dc.addOrder(Order.desc("client"));
			if (order_type.equals("paceasc"))
				dc.addOrder(Order.asc("pace"));
			if (order_type.equals("pacedesc"))
				dc.addOrder(Order.desc("pace"));
		} else {
			dc.addOrder(Order.desc("addTime"));
		}
		dc.add(Restrictions.eq("state", "1"));

		pageList = productService.findPageByCriteria(dc, pageSize, startIndex);
		
		if (getCurrentUser() != null)
			userId = getCurrentUser().getUserId();
		if (StringUtil.isNotBlank(islist2) && islist2.equals("list2")) {
			return "list2";
		}
		if (StringUtil.isNotBlank(islist2) && islist2.equals("mmlld")) {
			return "mmlld";
		}
		if (StringUtil.isNotBlank(islist2) && islist2.equals("zplld")) {
			return "zplld";
		}
		return LIST;
	}

	public String edit() {
		productService.load(entity, entity.getProductId());
		loadListSession();
		return EDIT;
	}

	public String infoUpdate() {
		/*if (getCurrentUser() != null
				&& getCurrentUser().getToWrite() != null
				&& (getCurrentUser().getToWrite().equals("0") || getCurrentUser()
						.getToWrite() == null)) {
			result = "对不起，您没有添加的权限，请联系管理员开通添加权限!";
			return "returnlist";
		}*/
		TdProduct td = new TdProduct();
		productService.load(td, entity.getProductId());
		if (entity.getBxt1() != 0)
			td.setBxt1(entity.getBxt1());
		if (entity.getBxt2() != 0)
			td.setBxt2(entity.getBxt2());
		if(StringUtil.isBlank(entity.getLscq22()))
			td.setLscq22("");
		else
			td.setLscq22(entity.getLscq22());
		if (entity.getBxt3() != 0)
			td.setBxt3(entity.getBxt3());
		if (entity.getLsqc1() != 0)
			td.setLsqc1(entity.getLsqc1());
		if (entity.getLsqc2() != 0)
			td.setLsqc2(entity.getLsqc2());
		if (entity.getLsqc3() != 0)
			td.setLsqc3(entity.getLsqc3());
		if (entity.getNk_bottom() != 0)
			td.setNk_bottom(entity.getNk_bottom());
		if (entity.getNk_left() != 0)
			td.setNk_left(entity.getNk_left());
		if (entity.getPfs1() != 0)
			td.setPfs1(entity.getPfs1());
		if (entity.getPfs2() != 0)
			td.setPfs2(entity.getPfs2());
		if (entity.getPfs3() != 0)
			td.setPfs3(entity.getPfs3());
		if (entity.getPfs4() != 0)
			td.setPfs4(entity.getPfs4());
		if (entity.getPfx1() != 0)
			td.setPfx1(entity.getPfs1());
		if (entity.getPfx2() != 0)
			td.setPfx2(entity.getPfx2());
		if (entity.getPfx3() != 0)
			td.setPfx3(entity.getPfx3());
		if (entity.getPfx4() != 0)
			td.setPfx4(entity.getPfx4());
		if (entity.getQc_height() != 0)
			td.setQc_height(entity.getQc_height());
		if (entity.getSd1() != 0)
			td.setSd1(entity.getSd1());
		if (entity.getSd2() != 0)
			td.setSd2(entity.getSd2());
		if (entity.getZd1() != 0)
			td.setZd1(entity.getZd1());
		if (entity.getZd2() != 0)
			td.setZd2(entity.getZd2());
		if (entity.getT1s() != 0)
			td.setT1s(entity.getT1s());
		if (entity.getT2s() != 0)
			td.setT2s(entity.getT2s());
		if (entity.getT3s() != 0)
			td.setT3s(entity.getT3s());
		if (entity.getT4s() != 0)
			td.setT4s(entity.getT4s());
		if (entity.getT1x() != 0)
			td.setT1x(entity.getT1x());
		if (entity.getT2x() != 0)
			td.setT2x(entity.getT2x());
		if (entity.getT3x() != 0)
			td.setT3x(entity.getT3x());
		if (entity.getT4x() != 0)
			td.setT4x(entity.getT4x());
		if (entity.getXl1() != 0)
			td.setXl1(entity.getXl1());
		if (entity.getXl2() != 0)
			td.setXl2(entity.getXl2());
		if (entity.getXl3() != 0)
			td.setXl3(entity.getXl3());
		if (entity.getXl4() != 0)
			td.setXl4(entity.getXl4());
		if (entity.getXl5() != 0)
			td.setXl5(entity.getXl5());
		if (entity.getXl6() != 0)
			td.setXl6(entity.getXl6());
		if (entity.getXl7() != 0)
			td.setXl7(entity.getXl7());
		if (entity.getXl8() != 0)
			td.setXl8(entity.getXl8());
		if (entity.getXlx1() != 0)
			td.setXlx1(entity.getXlx1());
		if (entity.getXlx2() != 0)
			td.setXlx2(entity.getXlx2());
		if (entity.getXlx3() != 0)
			td.setXlx3(entity.getXlx3());
		if (entity.getXlx4() != 0)
			td.setXlx4(entity.getXlx4());
		if (entity.getXlx5() != 0)
			td.setXlx5(entity.getXlx5());
		if (entity.getXlx6() != 0)
			td.setXlx6(entity.getXlx6());
		if (entity.getXlx7() != 0)
			td.setXlx7(entity.getXlx7());
		if (entity.getXlx8() != 0)
			td.setXlx8(entity.getXlx8());
		if (entity.getZongd1() != 0)
			td.setZongd1(entity.getZongd1());
		if (entity.getZongd2() != 0)
			td.setZongd2(entity.getZongd2());
		if (entity.getDtsck() != 0)
			td.setDtsck(entity.getDtsck());
		if (entity.getPwidth() != 0)
			td.setPwidth(entity.getPwidth());
		if (entity.getPheight() != 0)
			td.setPheight(entity.getPheight());
		if (entity.getHeight() != 0)
			td.setHeight(entity.getHeight());
		if (StringUtil.isNotBlank(entity.getLsqc()))
			td.setLsqc(entity.getLsqc());
		if (StringUtil.isNotBlank(entity.getRemarks()))
			td.setRemarks(entity.getRemarks());
		if (StringUtil.isNotBlank(entity.getZd3()))
			td.setZd3(entity.getZd3().trim());
		if (StringUtil.isNotBlank(entity.getSd3()))
			td.setSd3(entity.getSd3().trim());
		if (StringUtil.isNotBlank(entity.getZongd3()))
			td.setZongd3(entity.getZongd3().trim());
		if(StringUtil.isNotBlank(entity.getBxt()))
			td.setBxt("&nbsp;&nbsp;"+entity.getBxt());

		productService.update(td);
		return "infoUpdate";
	}

	public String info() {
		productService.load(entity, entity.getProductId());
		if (entity.getName().equals("四开子母封闭")) {
			skzmfb();
			return "skzmfb";
		}
		if (entity.getName().equals("四开封闭")) {
			skfb();
			return "skfb";
		}
		if (entity.getName().equals("对开封闭")) {
			dkfb();
			return "dkfb";
		}
		if (entity.getName().equals("子母封闭")) {
			zmfb();
			return "zmfb";
		}
		if (entity.getName().equals("单门封闭")) {
			dmfb();
			return "dmfb";
		}
		if (entity.getName().equals("单门")) {
			dm();
			return "dm";
		}
		if (entity.getName().equals("子母")) {
			if (entity.getLocks().indexOf("电控锁")>-1) {
				dks();
				return "dks";
			} else {
				zm();
				return "zm";
			}
		}
		if (entity.getName().equals("对开")) {
			if (entity.getLocks().indexOf("电控锁")>-1) {
				dkdks();
				return "dkdks";
			} else {
				dk();
				return "dk";
			}

		}
		if (entity.getName().equals("四开")) {
			sk();
			return "sk";
		}
		if (entity.getName().equals("四开子母")) {
			skzm();
			return "skzm";
		}
		return null;
	}

	private void skzm() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高
		float nk_bottom = entity.getNk_bottom() != 0 ? entity.getNk_bottom()
				: entity.getPwidth() - 84;
		float lsqc1 = entity.getLsqc1() != 0 ? entity.getLsqc1()
				: ((qc_height != 0) ? nk_bottom - 24 : 0);
		float lsqc2 = entity.getLsqc2() != 0 ? entity.getLsqc2()
				: ((qc_height != 0) ? qc_height - 55 : 0);
		float lsqc3 = entity.getLsqc3() != 0 ? entity.getLsqc3()
				: (qc_height != 0) ? entity.getProCount() : 0;
		float zd1 = entity.getZd1() != 0 ? entity.getZd1()
				: (entity.getDoorframe().equals("宽边") ? entity.getPheight() + 85
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPheight() + 60 : entity.getDoorframe()
								.equals("普边") ? entity.getPheight() : 0);
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : (entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0);
		float sd1 = entity.getSd1() != 0 ? entity.getSd1()
				: (entity.getDoorframe().equals("宽边") ? entity.getPwidth() - 84 + 260
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPwidth() - 84 + 210 : entity.getDoorframe()
								.equals("普边") ? entity.getPwidth() - 84 : 0);
		float sd2 = entity.getSd2() != 0 ? entity.getSd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
				.getPwidth() - 84;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;

		double t1s = entity.getT1s() != 0 ? entity.getT1s() : (entity
				.getPwidth() - 94) / 4 - 245.5; // 图1
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : t1s + 13 - 1;
		float t3s = entity.getT3s() != 0 ? entity.getT3s() : (new BigDecimal(
				((nk_bottom - t1s * 2 - 13) / 2 - 10)).setScale(0,
				BigDecimal.ROUND_HALF_UP)).floatValue();
		double t3x = entity.getT3x() != 0 ? entity.getT3x() : t3s + 13 - 1;
		double t2x = entity.getT2x() != 0 ? entity.getT2x() : nk_bottom - t1s
				* 2 - 44 - t3s + 1;
		double t2s = entity.getT2s() != 0 ? entity.getT2s() : t2x + 43 - 1;
		double t4s = entity.getT4s() != 0 ? entity.getT4s() : t1s;
		double t4x = entity.getT4x() != 0 ? entity.getT4x() : t4s + 13 - 1;
		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 128;
		float xl3 = entity.getXl3() != 0 ? entity.getXl2() : d_height - 55;
		double xl4 = entity.getXl4() != 0 ? entity.getXl4() : t2s + 43;
		float xl5 = entity.getXl5() != 0 ? entity.getXl5() : d_height - 55;
		double xl6 = entity.getXl6() != 0 ? entity.getXl6() : t3s + 128;
		float xl7 = entity.getXl7() != 0 ? entity.getXl7() : d_height - 55;
		double xl8 = entity.getXl8() != 0 ? entity.getXl8() : t4s + 128;
		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 99;
		float xlx3 = entity.getXlx3() != 0 ? entity.getXlx3() : d_height - 94;
		double xlx4 = entity.getXlx4() != 0 ? entity.getXlx4() : t2x + 185;
		float xlx5 = entity.getXlx5() != 0 ? entity.getXlx5() : d_height - 94;
		double xlx6 = entity.getXlx6() != 0 ? entity.getXlx6() : t3x + 99;
		float xlx7 = entity.getXlx7() != 0 ? entity.getXlx7() : d_height - 94;
		double xlx8 = entity.getXlx8() != 0 ? entity.getXlx8() : t4x + 99;
		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck() : t1s + t2x
				- 40 + 7;

		double pfs1 = entity.getPfs1() != 0 ? entity.getPfs1()
				: (t1s - 220) / 2 + 100;
		if(xl2<500)
			if(pfs1>140)
				pfs1 = 140;
		double pfx1 = entity.getPfx1() != 0 ? entity.getPfx1()
				: (t1x - 220) / 2 + 30;
		double pfs2 = entity.getPfs2() != 0 ? entity.getPfs2()
				: (t2s - 520) / 2 + 13;
		double pfx2 = entity.getPfx2() != 0 ? entity.getPfx2() : pfs2 + 60;
		double pfs3 = entity.getPfs3() != 0 ? entity.getPfs3() : pfx2;
		double pfx3 = entity.getPfx3() != 0 ? entity.getPfx3() : pfs2;
		double pfs4 = entity.getPfs4() != 0 ? entity.getPfs4() : pfs1;
		if(pfs1<130)
			pfs1 = 130;
		if(pfs2<150)
			pfs2 = 150;
		if(pfs4<130)
			pfs4 = 130;
		if(xl8<500)
			if(pfs4>140)
				pfs4=140;
		double pfx4 = entity.getPfx4() != 0 ? entity.getPfx4() : pfx1;
		depositInt("pfs1", pfs1);
		depositInt("pfx1", pfx1);
		depositInt("pfs2", pfs2);
		depositInt("pfx2", pfx2);
		depositInt("pfs3", pfs3);
		depositInt("pfx3", pfx3);
		depositInt("pfs4", pfs4);
		depositInt("pfx4", pfx4);

		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("nk_bottom", nk_bottom);
		depositInt("lsqc1", lsqc1);
		depositInt("lsqc2", lsqc2);
		depositInt("lsqc3", lsqc3);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("t2s", t2s);
		depositInt("t2x", t2x);
		depositInt("t3s", t3s);
		depositInt("t3x", t3x);
		depositInt("t4s", t4s);
		depositInt("t4x", t4x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xl3", xl3);
		depositInt("xl4", xl4);
		depositInt("xl5", xl5);
		depositInt("xl6", xl6);
		depositInt("xl7", xl7);
		depositInt("xl8", xl8);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("xlx3", xlx3);
		depositInt("xlx4", xlx4);
		depositInt("xlx5", xlx5);
		depositInt("xlx6", xlx6);
		depositInt("xlx7", xlx7);
		depositInt("xlx8", xlx8);
		depositInt("dtsck", dtsck);

	}

	private void sk() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高
		float nk_bottom = entity.getNk_bottom() != 0 ? entity.getNk_bottom()
				: entity.getPwidth() - 84;
		float lsqc1 = entity.getLsqc1() != 0 ? entity.getLsqc1()
				: (qc_height != 0) ? nk_bottom - 24 : 0;
		float lsqc2 = entity.getLsqc2() != 0 ? entity.getLsqc2()
				: (qc_height != 0) ? qc_height - 55 : 0;
		float lsqc3 = entity.getLsqc3() != 0 ? entity.getLsqc3()
				: (qc_height != 0) ? entity.getProCount() : 0;
		float zd1 = entity.getZd1() != 0 ? entity.getZd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPheight() + 85
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPheight() + 60 : entity.getDoorframe()
								.equals("普边") ? entity.getPheight() : 0;
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float sd1 = entity.getSd1() != 0 ? entity.getSd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPwidth() - 84 + 260
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPwidth() - 84 + 210 : entity.getDoorframe()
								.equals("普边") ? entity.getPwidth() - 84 : 0;
		float sd2 = entity.getSd2() != 0 ? entity.getSd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
				.getPwidth() - 84;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;
		double t1s = entity.getT1s() != 0 ? entity.getT1s() : (entity
				.getPwidth() - 94) / 4 - 1.5; // 图1
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : t1s + 13;
		double t3s = entity.getT3s() != 0 ? entity.getT3s() : (entity
				.getPwidth() - 86) / 4 - 10.5;
		double t3x = entity.getT3x() != 0 ? entity.getT3x() : t3s + 13;
		double t2x = entity.getT2x() != 0 ? entity.getT2x() : t3s - 13;
		double t2s = entity.getT2s() != 0 ? entity.getT2s() : t2x + 43;
		double t4s = entity.getT4s() != 0 ? entity.getT4s() : t1s;
		double t4x = entity.getT4x() != 0 ? entity.getT4x() : t4s + 13;
		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 128;
		float xl3 = entity.getXl3() != 0 ? entity.getXl3() : d_height - 55;
		double xl4 = entity.getXl4() != 0 ? entity.getXl4() : t2s + 43;
		float xl5 = entity.getXl5() != 0 ? entity.getXl5() : d_height - 55;
		double xl6 = entity.getXl6() != 0 ? entity.getXl6() : t3s + 128;
		float xl7 = entity.getXl7() != 0 ? entity.getXl7() : d_height - 55;
		double xl8 = entity.getXl8() != 0 ? entity.getXl8() : t4s + 128;
		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 99;
		float xlx3 = entity.getXlx3() != 0 ? entity.getXlx3() : d_height - 94;
		double xlx4 = entity.getXlx4() != 0 ? entity.getXlx4() : t2x + 185;
		float xlx5 = entity.getXlx5() != 0 ? entity.getXlx5() : d_height - 94;
		double xlx6 = entity.getXlx6() != 0 ? entity.getXlx6() : t3x + 99;
		float xlx7 = entity.getXlx7() != 0 ? entity.getXlx7() : d_height - 94;
		double xlx8 = entity.getXlx8() != 0 ? entity.getXlx8() : t4x + 99;
		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck() : t1s + t2x
				- 40 + 7;

		double pfs1 = entity.getPfs1() != 0 ? entity.getPfs1()
				: (xl2 <= 1000) ? ((t1s - 520) / 2 + 100) > 240 ? 240
						: ((t1s - 520) / 2 + 100) : ((t1s - 520) / 2 + 100);
		if (pfs1 < 130)
			pfs1 = 130;
		double pfx1 = entity.getPfx1() != 0 ? entity.getPfx1()
				: (t1x - 520) / 2 + 30 - 1;
		double pfs2 = entity.getPfs2() != 0 ? entity.getPfs2()
				: (t2s - 520) / 2 + 13;
		if (pfs2 < 150)
			pfs2 = 150;
		double pfx2 = entity.getPfx2() != 0 ? entity.getPfx2() : pfs2 + 60 - 1;
		double pfs3 = entity.getPfs3() != 0 ? entity.getPfs3() : pfx2;
		double pfx3 = entity.getPfx3() != 0 ? entity.getPfx3() : pfs2 - 1;
		double pfs4 = entity.getPfs4() != 0 ? entity.getPfs4() : pfs1;
		double pfx4 = entity.getPfx4() != 0 ? entity.getPfx4() : pfx1 - 1;
		depositInt("pfs1", pfs1);
		depositInt("pfx1", pfx1);
		depositInt("pfs2", pfs2);
		depositInt("pfx2", pfx2);
		depositInt("pfs3", pfs3);
		depositInt("pfx3", pfx3);
		depositInt("pfs4", pfs4);
		depositInt("pfx4", pfx4);

		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("nk_bottom", nk_bottom);
		depositInt("lsqc1", lsqc1);
		depositInt("lsqc2", lsqc2);
		depositInt("lsqc3", lsqc3);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("t2s", t2s);
		depositInt("t2x", t2x);
		depositInt("t3s", t3s);
		depositInt("t3x", t3x);
		depositInt("t4s", t4s);
		depositInt("t4x", t4x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xl3", xl3);
		depositInt("xl4", xl4);
		depositInt("xl5", xl5);
		depositInt("xl6", xl6);
		depositInt("xl7", xl7);
		depositInt("xl8", xl8);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("xlx3", xlx3);
		depositInt("xlx4", xlx4);
		depositInt("xlx5", xlx5);
		depositInt("xlx6", xlx6);
		depositInt("xlx7", xlx7);
		depositInt("xlx8", xlx8);
		depositInt("dtsck", dtsck);

	}

	private void dk() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高
		float nk_left = entity.getNk_left() != 0 ? entity.getNk_left()
				: d_height - 83;
		float nk_bottom = entity.getNk_bottom() != 0 ? entity.getNk_bottom()
				: entity.getPwidth() - 84;
		float lsqc1 = entity.getLsqc1() != 0 ? entity.getLsqc1()
				: (qc_height != 0) ? nk_bottom - 26 : 0;
		float lsqc2 = entity.getLsqc2() != 0 ? entity.getLsqc2()
				: (qc_height != 0) ? qc_height - 55 : 0;
		float lsqc3 = entity.getLsqc3() != 0 ? entity.getLsqc3()
				: (qc_height != 0) ? entity.getProCount() : 0;
		float zd1 = entity.getZd1() != 0 ? entity.getZd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPheight() + 85
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPheight() + 60 : entity.getDoorframe()
								.equals("普边") ? entity.getPheight() : 0;
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float sd1 = entity.getSd1() != 0 ? entity.getSd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPwidth() - 84 + 260
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPwidth() - 84 + 210 : entity.getDoorframe()
								.equals("普边") ? entity.getPwidth() - 84 : 0;
		float sd2 = entity.getSd2() != 0 ? entity.getSd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
				.getPwidth() - 84;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;

		double t2s = entity.getT2s() != 0 ? entity.getT2s() : (entity
				.getPwidth() - 92) / 2 - 7;
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : entity
				.getPwidth() - 84 - t2s - 38 - 1;
		double t1s = entity.getT1s() != 0 ? entity.getT1s() : t1x + 43; // 图1
		double t2x = entity.getT2x() != 0 ? entity.getT2x() : t2s + 13 - 1;

		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 43;
		float xl3 = entity.getXl3() != 0 ? entity.getXl3() : d_height - 55;
		double xl4 = entity.getXl4() != 0 ? entity.getXl4() : t2s + 128;

		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 185;
		float xlx3 = entity.getXlx3() != 0 ? entity.getXlx3() : d_height - 94;
		double xlx4 = entity.getXlx4() != 0 ? entity.getXlx4() : t2x + 99;

		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck()
				: t1x - 40 + 5;

		double pfs1 = entity.getPfs1() != 0 ? entity.getPfs1()
				: (t1s - 520) / 2 + 13;
		if (pfs1 < 150)
			pfs1 = 150;
		double pfx1 = entity.getPfx1() != 0 ? entity.getPfx1() : pfs1 + 60;
		double pfs2 = entity.getPfs2() != 0 ? entity.getPfs2() : pfx1;
		double pfx2 = entity.getPfx2() != 0 ? entity.getPfx2() : pfs2 - 60;

		depositInt("pfs1", pfs1);
		depositInt("pfx1", pfx1);
		depositInt("pfs2", pfs2);
		depositInt("pfx2", pfx2);

		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("nk_left", nk_left);
		depositInt("nk_bottom", nk_bottom);
		depositInt("lsqc1", lsqc1);
		depositInt("lsqc2", lsqc2);
		depositInt("lsqc3", lsqc3);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("t2s", t2s);
		depositInt("t2x", t2x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xl3", xl3);
		depositInt("xl4", xl4);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("xlx3", xlx3);
		depositInt("xlx4", xlx4);
		depositInt("dtsck", dtsck);
	}

	private void dks() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高

		float lsqc1 = entity.getLsqc1() != 0 ? entity.getLsqc1()
				: (qc_height != 0) ? entity.getPwidth() - 84 - 24 : 0;
		float lsqc2 = entity.getLsqc2() != 0 ? entity.getLsqc2()
				: (qc_height != 0) ? qc_height - 55 : 0;
		float lsqc3 = entity.getLsqc3() != 0 ? entity.getLsqc3()
				: (qc_height != 0) ? entity.getProCount() : 0;

		float zd1 = entity.getZd1() != 0 ? entity.getZd1() : entity
				.getPheight();
		if(entity.getDoorframe().equals("宽边"))
			zd1 = entity.getZd1() != 0 ? entity.getZd1() : entity
					.getPheight()+85;
		if(entity.getDoorframe().equals("外宽边"))
			zd1 = entity.getZd1() != 0 ? entity.getZd1() : entity
						.getPheight()+60;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
				.getPwidth() - 84;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : 250;
		if(entity.getDoorframe().equals("宽边"))
			zd2 = entity.getZd2() != 0 ? entity.getZd2() : 350;
		if(entity.getDoorframe().equals("外宽边"))
			zd2 = entity.getZd2() != 0 ? entity.getZd2() : 326;
		float sd1 = entity.getSd1() != 0 ? entity.getSd1() : bxt1;
		float sd2 = entity.getSd2() != 0 ? entity.getSd2() : 250;
		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;
		if(entity.getDoorframe().equals("宽边")){
			sd1 = entity.getSd1() != 0 ? entity.getSd1() : bxt1+260; 
			sd2 = entity.getSd2() != 0 ? entity.getSd2() : 350;
		}
		if(entity.getDoorframe().equals("外宽边")){
			sd1 = entity.getSd1() != 0 ? entity.getSd1() : bxt1+210; 
			sd2 = entity.getSd2() != 0 ? entity.getSd2() : 326;
		}
		double t1s = entity.getT1s() != 0 ? entity.getT1s() : entity
				.getPwidth() / 2 + 160; // 图1
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : t1s - 46;
		double t2s = entity.getT2s() != 0 ? entity.getT2s() : entity
				.getPwidth() - 91 - t1s;
		double t2x = entity.getT2x() != 0 ? entity.getT2x() : t2s + 13;

		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 55;
		float xl3 = entity.getXl3() != 0 ? entity.getXl3() : d_height - 55;
		double xl4 = entity.getXl4() != 0 ? entity.getXl4() : t2s + 125;

		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 182;
		float xlx3 = entity.getXlx3() != 0 ? entity.getXlx3() : d_height - 94;
		double xlx4 = entity.getXlx4() != 0 ? entity.getXlx4() : t2x + 109;

		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck()
				: t1x - 40 + 5;

		double pfs1 = entity.getPfs1() != 0 ? entity.getPfs1()
				: (xl2 - 520) / 2;
		double pfx1 = entity.getPfx1() != 0 ? entity.getPfx1()
				: (t1x - 520) / 2 + 97;

		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("pfs1", pfs1);
		depositInt("pfx1", pfx1);
		depositInt("lsqc1", lsqc1);
		depositInt("lsqc2", lsqc2);
		depositInt("lsqc3", lsqc3);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("t2s", t2s);
		depositInt("t2x", t2x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xl3", xl3);
		depositInt("xl4", xl4);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("xlx3", xlx3);
		depositInt("xlx4", xlx4);
		depositInt("dtsck", dtsck);

	}
	private void dkdks() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高

		float lsqc1 = entity.getLsqc1() != 0 ? entity.getLsqc1()
				: (qc_height != 0) ? entity.getPwidth() - 84 - 24 : 0;
		float lsqc2 = entity.getLsqc2() != 0 ? entity.getLsqc2()
				: (qc_height != 0) ? qc_height - 55 : 0;
		float lsqc3 = entity.getLsqc3() != 0 ? entity.getLsqc3()
				: (qc_height != 0) ? entity.getProCount() : 0;

				float zd1 = entity.getZd1() != 0 ? entity.getZd1() : entity
						.getPheight();
				if(entity.getDoorframe().equals("宽边"))
					zd1 = entity.getZd1() != 0 ? entity.getZd1() : entity
							.getPheight()+85;
				if(entity.getDoorframe().equals("外宽边"))
					zd1 = entity.getZd1() != 0 ? entity.getZd1() : entity
								.getPheight()+60;
				float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
						.getPwidth() - 84;
				float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
				float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
						.getPwidth() - 136;
				float zd2 = entity.getZd2() != 0 ? entity.getZd2() : 250;
				if(entity.getDoorframe().equals("宽边"))
					zd2 = entity.getZd2() != 0 ? entity.getZd2() : 350;
				if(entity.getDoorframe().equals("外宽边"))
					zd2 = entity.getZd2() != 0 ? entity.getZd2() : 326;
				float sd1 = entity.getSd1() != 0 ? entity.getSd1() : bxt1;
				float sd2 = entity.getSd2() != 0 ? entity.getSd2() : 250;
				float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
						.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
				float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
						.getHeight() != 0) ? 250 : 0;
				if(entity.getDoorframe().equals("宽边")){
					sd1 = entity.getSd1() != 0 ? entity.getSd1() : bxt1+260; 
					sd2 = entity.getSd2() != 0 ? entity.getSd2() : 350;
				}
				if(entity.getDoorframe().equals("外宽边")){
					sd1 = entity.getSd1() != 0 ? entity.getSd1() : bxt1+210; 
					sd2 = entity.getSd2() != 0 ? entity.getSd2() : 326;
				}

		double t1s = entity.getT1s() != 0 ? entity.getT1s() : bxt1/2; // 图1
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : t1s - 46;
		double t2s = entity.getT2s() != 0 ? entity.getT2s() : bxt1-t1s-7;
		double t2x = entity.getT2x() != 0 ? entity.getT2x() : t2s + 13;

		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 55;
		float xl3 = entity.getXl3() != 0 ? entity.getXl3() : d_height - 55;
		double xl4 = entity.getXl4() != 0 ? entity.getXl4() : t2s + 125;

		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 182;
		float xlx3 = entity.getXlx3() != 0 ? entity.getXlx3() : d_height - 94;
		double xlx4 = entity.getXlx4() != 0 ? entity.getXlx4() : t2x + 109;

		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck()
				: t1x - 40 + 5;

		double pfs1 = entity.getPfs1() != 0 ? entity.getPfs1()
				: (xl2 - 520) / 2;
		double pfx1 = entity.getPfx1() != 0 ? entity.getPfx1()
				: (t1x - 520) / 2 + 97;

		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("pfs1", pfs1);
		depositInt("pfx1", pfx1);
		depositInt("lsqc1", lsqc1);
		depositInt("lsqc2", lsqc2);
		depositInt("lsqc3", lsqc3);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("t2s", t2s);
		depositInt("t2x", t2x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xl3", xl3);
		depositInt("xl4", xl4);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("xlx3", xlx3);
		depositInt("xlx4", xlx4);
		depositInt("dtsck", dtsck);

	}
	private void zm() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高

		float nk_left = entity.getNk_left() != 0 ? entity.getNk_left()
				: d_height - 83;
		float nk_bottom = entity.getNk_bottom() != 0 ? entity.getNk_bottom()
				: entity.getPwidth() - 84;
		float lsqc1 = entity.getLsqc1() != 0 ? entity.getLsqc1()
				: (qc_height != 0) ? nk_bottom - 26 : 0;
		float lsqc2 = entity.getLsqc2() != 0 ? entity.getLsqc2()
				: (qc_height != 0) ? qc_height - 55 : 0;
		float lsqc3 = entity.getLsqc3() != 0 ? entity.getLsqc3()
				: (qc_height != 0) ? entity.getProCount() : 0;

		float zd1 = entity.getZd1() != 0 ? entity.getZd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPheight() + 85
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPheight() + 60 : entity.getDoorframe()
								.equals("普边") ? entity.getPheight() : 0;
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float sd1 = entity.getSd1() != 0 ? entity.getSd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPwidth() - 84 + 260
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPwidth() - 84 + 210 : entity.getDoorframe()
								.equals("普边") ? entity.getPwidth() - 84 : 0;
		float sd2 = entity.getSd2() != 0 ? entity.getSd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
				.getPwidth() - 84;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;
		double t1s = entity.getT1s() != 0 ? entity.getT1s() : entity
				.getPwidth() / 2 + 190; // 图1
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : t1s - 43 - 1;
		double t2s = entity.getT2s() != 0 ? entity.getT2s() : entity
				.getPwidth() - 92 - t1x - 30;
		double t2x = entity.getT2x() != 0 ? entity.getT2x() : t2s + 13;

		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 43;
		float xl3 = entity.getXl3() != 0 ? entity.getXl3() : d_height - 55;
		double xl4 = entity.getXl4() != 0 ? entity.getXl4() : t2s + 128;

		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 185;
		float xlx3 = entity.getXlx3() != 0 ? entity.getXlx3() : d_height - 94;
		double xlx4 = entity.getXlx4() != 0 ? entity.getXlx4() : t2x + 99;

		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck()
				: t1x - 40 + 5;

		double pfs1 = entity.getPfs1() != 0 ? entity.getPfs1()
				: (t1s - 520) / 2 + 13;
		double pfs2 = entity.getPfs2() != 0 ? entity.getPfs2()
				: (t2s - 220) / 2 + 100;
		if(pfs1<150)
			pfs1 = 150;
		if (xl4 > 428 && xl4 < 500)
			pfs2 = 140;
		double pfx1 = entity.getPfx1() != 0 ? entity.getPfx1() : pfs1 + 60;
		double pfx2 = entity.getPfx2() != 0 ? entity.getPfx2()
				: (t2x - 220) / 2 + 30;

		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("nk_left", nk_left);
		depositInt("nk_bottom", nk_bottom);
		depositInt("lsqc1", lsqc1);
		depositInt("lsqc2", lsqc2);
		depositInt("lsqc3", lsqc3);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("t2s", t2s);
		depositInt("t2x", t2x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xl3", xl3);
		depositInt("xl4", xl4);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("xlx3", xlx3);
		depositInt("xlx4", xlx4);
		depositInt("dtsck", dtsck);

		depositInt("pfs1", pfs1);
		depositInt("pfs2", pfs2);
		depositInt("pfx1", pfx1);
		depositInt("pfx2", pfx2);
	}

	private void dm() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高
		float nk_left = entity.getNk_left() != 0 ? entity.getNk_left()
				: d_height - 83;
		float nk_bottom = entity.getNk_bottom() != 0 ? entity.getNk_bottom()
				: entity.getPwidth() - 84;
		float lsqc1 = entity.getLsqc1() != 0 ? entity.getLsqc1()
				: (qc_height != 0) ? nk_bottom - 26 : 0;
		float lsqc2 = entity.getLsqc2() != 0 ? entity.getLsqc2()
				: (qc_height != 0) ? qc_height - 55 : 0;
		float lsqc3 = entity.getLsqc3() != 0 ? entity.getLsqc3()
				: (qc_height != 0) ? entity.getProCount() : 0;

		float zd1 = entity.getZd1() != 0 ? entity.getZd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPheight() + 65
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPheight() + 40 : entity.getDoorframe()
								.equals("普边") ? entity.getPheight() : 0;
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : entity
				.getDoorframe().equals("宽边") ? 330 : entity.getDoorframe()
				.equals("外宽边") ? 308 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float zd3 = 2108;
		float zd4 = 250;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : nk_bottom;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;

		float sd1 = entity.getSd1() != 0 ? entity.getSd1() : entity
				.getDoorframe().equals("宽边") ? bxt1 + 220 : entity
				.getDoorframe().equals("外宽边") ? entity.getPwidth() - 84 + 170
				: entity.getDoorframe().equals("普边") ? entity.getPwidth() - 84
						: 0;
		float sd2 = entity.getSd2() != 0 ? entity.getSd2() : entity
				.getDoorframe().equals("宽边") ? 330 : entity.getDoorframe()
				.equals("外宽边") ? 308 : entity.getDoorframe().equals("普边") ? 250
				: 0;

		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;

		double t1s = entity.getT1s() != 0 ? entity.getT1s() : nk_bottom - 5; // 图1
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : t1s - 33;

		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 55;
		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 167;
		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck() : 48;

		double pfs1 = entity.getPfs1() != 0 ? entity.getPfs1()
				: (t1s - 520) / 2 + 28;
		if (pfs1 < 140)
			pfs1 = 140;
		double pfx1 = entity.getPfx1() != 0 ? entity.getPfx1() : pfs1 + 40;

		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("nk_left", nk_left);
		depositInt("nk_bottom", nk_bottom);
		depositInt("lsqc1", lsqc1);
		depositInt("lsqc2", lsqc2);
		depositInt("lsqc3", lsqc3);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("dtsck", dtsck);

		depositInt("pfs1", pfs1);
		depositInt("pfx1", pfx1);
	}

	private void dmfb() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高
		float left3 = entity.getLeft3() != 0 ? entity.getLeft3() : entity
				.getPwidth() - 86;
		float left4 = entity.getLeft4() != 0 ? entity.getLeft4() : left3 - 34;
		float left5 = entity.getLeft5() != 0 ? entity.getLeft5() : left3 + 55;
		float left8 = entity.getLeft8() != 0 ? entity.getLeft8()
				: qc_height - 44;
		float left6 = entity.getLeft6() != 0 ? entity.getLeft6() : left8 + 34;
		float left7 = entity.getLeft7() != 0 ? entity.getLeft7() : left8 - 16;
		float left9 = entity.getLeft9() != 0 ? entity.getLeft9() : left4 + 13;
		float left10 = entity.getLeft10() != 0 ? entity.getLeft10()
				: left7 + 14;
		float zd1 = entity.getZd1() != 0 ? entity.getZd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPheight() + 65
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPheight() + 40 : entity.getDoorframe()
								.equals("普边") ? entity.getPheight() : 0;
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : entity
				.getDoorframe().equals("宽边") ? 330 : entity.getDoorframe()
				.equals("外宽边") ? 308 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float sd1 = entity.getSd1() != 0 ? entity.getSd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPwidth() - 84 + 220
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPwidth() - 84 + 170 : entity.getDoorframe()
								.equals("普边") ? entity.getPwidth() - 84 : 0;
		float sd2 = entity.getSd2() != 0 ? entity.getSd2() : entity
				.getDoorframe().equals("宽边") ? 330 : entity.getDoorframe()
				.equals("外宽边") ? 308 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
				.getPwidth() - 84;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;

		double t1s = entity.getT1s() != 0 ? entity.getT1s() : entity
				.getPwidth() - 89; // 图1
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : t1s - 33;
		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 55;
		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 167;
		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck() : 48;
		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("left3", left3);
		depositInt("left4", left4);
		depositInt("left5", left5);
		depositInt("left6", left6);
		depositInt("left7", left7);
		depositInt("left8", left8);
		depositInt("left9", left9);
		depositInt("left10", left10);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("dtsck", dtsck);
	}

	private void zmfb() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高
		float left3 = entity.getLeft3() != 0 ? entity.getLeft3() : entity
				.getPwidth() - 86;
		float left4 = entity.getLeft4() != 0 ? entity.getLeft4() : left3 - 34;
		float left5 = entity.getLeft5() != 0 ? entity.getLeft5() : left3 + 55;
		float left8 = entity.getLeft6() != 0 ? entity.getLeft6()
				: qc_height - 44;
		float left6 = entity.getLeft7() != 0 ? entity.getLeft7() : left8 + 34;
		float left7 = entity.getLeft8() != 0 ? entity.getLeft8() : left8 - 16;
		float left9 = entity.getLeft9() != 0 ? entity.getLeft9() : left4 + 13;
		float left10 = entity.getLeft10() != 0 ? entity.getLeft10()
				: left7 + 13;
		float zd1 = entity.getZd1() != 0 ? entity.getZd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPheight() + 85
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPheight() + 60 : entity.getDoorframe()
								.equals("普边") ? entity.getPheight() : 0;
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float sd1 = entity.getSd1() != 0 ? entity.getSd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPwidth() - 84 + 260
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPwidth() - 84 + 210 : entity.getDoorframe()
								.equals("普边") ? entity.getPwidth() - 84 : 0;
		float sd2 = entity.getSd2() != 0 ? entity.getSd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
				.getPwidth() - 84;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;
		double t1s = entity.getT1s() != 0 ? entity.getT1s() : entity
				.getPwidth() / 2 + 190; // 图1
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : t1s - 43;
		double t2s = entity.getT2s() != 0 ? entity.getT2s() : entity
				.getPwidth() - 92 - t1x - 30;
		double t2x = entity.getT2x() != 0 ? entity.getT2x() : t2s + 13;

		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 43;
		float xl3 = entity.getXl3() != 0 ? entity.getXl3() : d_height - 55;
		double xl4 = entity.getXl4() != 0 ? entity.getXl4() : t2s + 128;

		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 185;
		float xlx3 = entity.getXlx3() != 0 ? entity.getXlx3() : d_height - 94;
		double xlx4 = entity.getXlx4() != 0 ? entity.getXlx4() : t2x + 99;

		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck()
				: t1x - 40 + 5;

		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("left3", left3);
		depositInt("left4", left4);
		depositInt("left5", left5);
		depositInt("left6", left6);
		depositInt("left7", left7);
		depositInt("left8", left8);
		depositInt("left9", left9);
		depositInt("left10", left10);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("t2s", t2s);
		depositInt("t2x", t2x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xl3", xl3);
		depositInt("xl4", xl4);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("xlx3", xlx3);
		depositInt("xlx4", xlx4);
		depositInt("dtsck", dtsck);
	}

	private void dkfb() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高
		float left3 = entity.getLeft3() != 0 ? entity.getLeft3() : entity
				.getPwidth() - 86;
		float left4 = entity.getLeft4() != 0 ? entity.getLeft4() : left3 - 34;
		float left5 = entity.getLeft5() != 0 ? entity.getLeft5() : left3 + 55;
		float left8 = entity.getLeft8() != 0 ? entity.getLeft8()
				: qc_height - 44;
		float left6 = entity.getLeft6() != 0 ? entity.getLeft6() : left8 + 34;
		float left7 = entity.getLeft7() != 0 ? entity.getLeft7() : left8 - 16;
		float left9 = entity.getLeft9() != 0 ? entity.getLeft9() : left4 + 13;
		float left10 = entity.getLeft10() != 0 ? entity.getLeft10()
				: left7 + 13;
		float zd1 = entity.getZd1() != 0 ? entity.getZd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPheight() + 85
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPheight() + 60 : entity.getDoorframe()
								.equals("普边") ? entity.getPheight() : 0;
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float sd1 = entity.getSd1() != 0 ? entity.getSd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPwidth() - 84 + 260
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPwidth() - 84 + 210 : entity.getDoorframe()
								.equals("普边") ? entity.getPwidth() - 84 : 0;
		float sd2 = entity.getSd2() != 0 ? entity.getSd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
				.getPwidth() - 84;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;

		double t2s = entity.getT2s() != 0 ? entity.getT2s() : (entity
				.getPwidth() - 92) / 2 - 7;
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : entity
				.getPwidth() - 84 - t2s - 38;
		double t1s = entity.getT1s() != 0 ? entity.getT1s() : t1x + 43; // 图1
		double t2x = entity.getT2x() != 0 ? entity.getT2x() : t2s + 13;

		float xl1 = entity.getXl1() != 0 ? entity.getXl2() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 43;
		float xl3 = entity.getXl3() != 0 ? entity.getXl3() : d_height - 55;
		double xl4 = entity.getXl4() != 0 ? entity.getXl4() : t2s + 128;

		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 185;
		float xlx3 = entity.getXlx3() != 0 ? entity.getXlx3() : d_height - 94;
		double xlx4 = entity.getXlx4() != 0 ? entity.getXlx4() : t2x + 99;

		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck()
				: t1x - 40 + 5;

		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("left3", left3);
		depositInt("left4", left4);
		depositInt("left5", left5);
		depositInt("left6", left6);
		depositInt("left7", left7);
		depositInt("left8", left8);
		depositInt("left9", left9);
		depositInt("left10", left10);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("t2s", t2s);
		depositInt("t2x", t2x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xl3", xl3);
		depositInt("xl4", xl4);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("xlx3", xlx3);
		depositInt("xlx4", xlx4);
		depositInt("dtsck", dtsck);
	}

	private void skfb() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高
		float nk_left = entity.getNk_left() != 0 ? entity.getNk_left() : entity
				.getPwidth() - 84;
		float left3 = entity.getLeft3() != 0 ? entity.getLeft3() : (entity
				.getPwidth() - 120) / 2 + 2;
		float left4 = entity.getLeft4() != 0 ? entity.getLeft4()
				: qc_height - 57;
		float zd1 = entity.getZd1() != 0 ? entity.getZd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPheight() + 85
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPheight() + 60 : entity.getDoorframe()
								.equals("普边") ? entity.getPheight() : 0;
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float sd1 = entity.getSd1() != 0 ? entity.getSd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPwidth() - 84 + 260
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPwidth() - 84 + 210 : entity.getDoorframe()
								.equals("普边") ? entity.getPwidth() - 84 : 0;
		float sd2 = entity.getSd2() != 0 ? entity.getSd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
				.getPwidth() - 84;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;
		double t1s = entity.getT1s() != 0 ? entity.getT1s() : (entity
				.getPwidth() - 94) / 4 - 1.5; // 图1
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : t1s + 13;
		double t3s = entity.getT3s() != 0 ? entity.getT3s() : (entity
				.getPwidth() - 86) / 4 - 10.5;
		double t3x = entity.getT3x() != 0 ? entity.getT3x() : t3s + 13;
		double t2x = entity.getT2x() != 0 ? entity.getT2x() : entity
				.getPwidth() - 84 - t1s * 2 - t3s - 44;
		double t2s = entity.getT2s() != 0 ? entity.getT2s() : t2x + 43;
		double t4s = entity.getT4s() != 0 ? entity.getT4s() : t1s;
		double t4x = entity.getT4x() != 0 ? entity.getT4x() : t4s + 13;
		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 128;
		float xl3 = entity.getXl3() != 0 ? entity.getXl3() : d_height - 55;
		double xl4 = entity.getXl4() != 0 ? entity.getXl4() : t2s + 43;
		float xl5 = entity.getXl5() != 0 ? entity.getXl5() : d_height - 55;
		double xl6 = entity.getXl6() != 0 ? entity.getXl6() : t3s + 128;
		float xl7 = entity.getXl7() != 0 ? entity.getXl7() : d_height - 55;
		double xl8 = entity.getXl8() != 0 ? entity.getXl8() : t4s + 128;
		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 99;
		float xlx3 = entity.getXlx3() != 0 ? entity.getXlx3() : d_height - 94;
		double xlx4 = entity.getXlx4() != 0 ? entity.getXlx4() : t2x + 185;
		float xlx5 = entity.getXlx5() != 0 ? entity.getXlx5() : d_height - 94;
		double xlx6 = entity.getXlx6() != 0 ? entity.getXlx6() : t3x + 99;
		float xlx7 = entity.getXlx7() != 0 ? entity.getXlx7() : d_height - 94;
		double xlx8 = entity.getXlx8() != 0 ? entity.getXlx8() : t4x + 99;
		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck() : t1s + t2x
				- 40 + 7;
		float qcxl1 = entity.getQcxl1() != 0 ? entity.getQcxl1() : left3 + 14;
		float qcxl2 = entity.getQcxl2() != 0 ? entity.getQcxl2() : left4 + 14;
		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("nk_left", nk_left);
		depositInt("left3", left3);
		depositInt("left4", left4);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("t2s", t2s);
		depositInt("t2x", t2x);
		depositInt("t3s", t3s);
		depositInt("t3x", t3x);
		depositInt("t4s", t4s);
		depositInt("t4x", t4x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xl3", xl3);
		depositInt("xl4", xl4);
		depositInt("xl5", xl5);
		depositInt("xl6", xl6);
		depositInt("xl7", xl7);
		depositInt("xl8", xl8);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("xlx3", xlx3);
		depositInt("xlx4", xlx4);
		depositInt("xlx5", xlx5);
		depositInt("xlx6", xlx6);
		depositInt("xlx7", xlx7);
		depositInt("xlx8", xlx8);
		depositInt("dtsck", dtsck);
		depositInt("qcxl1", qcxl1);
		depositInt("qcxl2", qcxl2);
	}

	private void skzmfb() {
		float d_height = entity.getD_height() != 0 ? entity.getD_height()
				: entity.getHeight() == 0 ? entity.getPheight() : entity
						.getHeight(); // 门高
		float qc_height = entity.getQc_height() != 0 ? entity.getQc_height()
				: entity.getPheight() - d_height; // 气窗高
		float nk_left = entity.getNk_left() != 0 ? entity.getNk_left() : entity
				.getPwidth() - 84;
		float left3 = entity.getLeft3() != 0 ? entity.getLeft3() : (entity
				.getPwidth() - 120) / 2 + 2;
		float left4 = entity.getLeft4() != 0 ? entity.getLeft4()
				: qc_height - 57;
		float zd1 = entity.getZd1() != 0 ? entity.getZd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPheight() + 85
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPheight() + 60 : entity.getDoorframe()
								.equals("普边") ? entity.getPheight() : 0;
		float zd2 = entity.getZd2() != 0 ? entity.getZd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float sd1 = entity.getSd1() != 0 ? entity.getSd1()
				: entity.getDoorframe().equals("宽边") ? entity.getPwidth() - 84 + 260
						: entity.getDoorframe().equals("外宽边") ? entity
								.getPwidth() - 84 + 210 : entity.getDoorframe()
								.equals("普边") ? entity.getPwidth() - 84 : 0;
		float sd2 = entity.getSd1() != 0 ? entity.getSd2() : entity
				.getDoorframe().equals("宽边") ? 350 : entity.getDoorframe()
				.equals("外宽边") ? 326 : entity.getDoorframe().equals("普边") ? 250
				: 0;
		float zongd1 = entity.getZongd1() != 0 ? entity.getZongd1() : (entity
				.getHeight() != 0) ? entity.getPwidth() - 84 : 0;
		float zongd2 = entity.getZongd2() != 0 ? entity.getZongd2() : (entity
				.getHeight() != 0) ? 250 : 0;
		float bxt1 = entity.getBxt1() != 0 ? entity.getBxt1() : entity
				.getPwidth() - 84;
		float bxt2 = entity.getBxt2() != 0 ? entity.getBxt2() : 225;
		float bxt3 = entity.getBxt3() != 0 ? entity.getBxt3() : entity
				.getPwidth() - 136;
		double t1s = entity.getT1s() != 0 ? entity.getT1s() : (entity
				.getPwidth() - 94) / 4 - 245.5; // 图1
		double t1x = entity.getT1x() != 0 ? entity.getT1x() : t1s + 13;
		double t3s = entity.getT3s() != 0 ? entity.getT3s() : (nk_left - t1s
				* 2 - 14) / 2 - 10;
		double t3x = entity.getT3x() != 0 ? entity.getT3x() : t3s + 13;
		double t2x = entity.getT2x() != 0 ? entity.getT2x() : entity
				.getPwidth() - t1s * 2 - t3s - 44 - 84;
		double t2s = entity.getT2s() != 0 ? entity.getT2s() : t2x + 43;
		double t4s = entity.getT4s() != 0 ? entity.getT4s() : t1s;
		double t4x = entity.getT4x() != 0 ? entity.getT4x() : t4s + 13;
		float xl1 = entity.getXl1() != 0 ? entity.getXl1() : d_height - 55;
		double xl2 = entity.getXl2() != 0 ? entity.getXl2() : t1s + 128;
		float xl3 = entity.getXl3() != 0 ? entity.getXl3() : d_height - 55;
		double xl4 = entity.getXl4() != 0 ? entity.getXl4() : t2s + 43;
		float xl5 = entity.getXl5() != 0 ? entity.getXl5() : d_height - 55;
		double xl6 = entity.getXl6() != 0 ? entity.getXl6() : t3s + 128;
		float xl7 = entity.getXl7() != 0 ? entity.getXl7() : d_height - 55;
		double xl8 = entity.getXl8() != 0 ? entity.getXl8() : t4s + 128;
		float xlx1 = entity.getXlx1() != 0 ? entity.getXlx1() : d_height - 94;
		double xlx2 = entity.getXlx2() != 0 ? entity.getXlx2() : t1x + 99;
		float xlx3 = entity.getXlx3() != 0 ? entity.getXlx3() : d_height - 94;
		double xlx4 = entity.getXlx4() != 0 ? entity.getXlx4() : t2x + 187;
		float xlx5 = entity.getXlx5() != 0 ? entity.getXlx5() : d_height - 94;
		double xlx6 = entity.getXlx6() != 0 ? entity.getXlx6() : t3x + 99;
		float xlx7 = entity.getXlx7() != 0 ? entity.getXlx7() : d_height - 94;
		double xlx8 = entity.getXlx8() != 0 ? entity.getXlx8() : t4x + 99;
		double dtsck = entity.getDtsck() != 0 ? entity.getDtsck() : t1s + t2x
				- 40 + 7;
		float qcxl1 = entity.getQcxl1() != 0 ? entity.getQcxl1() : left3 + 14;
		float qcxl2 = entity.getQcxl2() != 0 ? entity.getQcxl2() : left4 + 14;
		depositInt("d_height", d_height);
		depositInt("qc_height", qc_height);
		depositInt("nk_left", nk_left);
		depositInt("left3", left3);
		depositInt("left4", left4);
		depositInt("zd1", zd1);
		depositInt("zd2", zd2);
		depositInt("sd1", sd1);
		depositInt("sd2", sd2);
		depositInt("zongd1", zongd1);
		depositInt("zongd2", zongd2);
		depositInt("bxt1", bxt1);
		depositInt("bxt2", bxt2);
		depositInt("bxt3", bxt3);
		depositInt("t1s", t1s);
		depositInt("t1x", t1x);
		depositInt("t2s", t2s);
		depositInt("t2x", t2x);
		depositInt("t3s", t3s);
		depositInt("t3x", t3x);
		depositInt("t4s", t4s);
		depositInt("t4x", t4x);
		depositInt("xl1", xl1);
		depositInt("xl2", xl2);
		depositInt("xl3", xl3);
		depositInt("xl4", xl4);
		depositInt("xl5", xl5);
		depositInt("xl6", xl6);
		depositInt("xl7", xl7);
		depositInt("xl8", xl8);
		depositInt("xlx1", xlx1);
		depositInt("xlx2", xlx2);
		depositInt("xlx3", xlx3);
		depositInt("xlx4", xlx4);
		depositInt("xlx5", xlx5);
		depositInt("xlx6", xlx6);
		depositInt("xlx7", xlx7);
		depositInt("xlx8", xlx8);
		depositInt("dtsck", dtsck);
		depositInt("qcxl1", qcxl1);
		depositInt("qcxl2", qcxl2);
	}

	public String add() {
		DetachedCriteria dc = DetachedCriteria.forClass(entityClass);
		dc.addOrder(Order.desc("productId"));
		PaginationSupport list = productService.findPageByCriteria(dc,
				pageSize, startIndex);
		String bh = "";
		if(!list.getItems().isEmpty()){
			TdProduct td = (TdProduct) list.getItems().get(0);
			String lastTime = td.getPnumber();
			if(StringUtil.isNotBlank(lastTime)){
				try{
					int tt = Integer.parseInt(lastTime.substring(lastTime.lastIndexOf("-")+1,lastTime.length()))+1;
					bh = lastTime.substring(0,lastTime.lastIndexOf("-")+1)+tt;
				}
				catch(Exception e){
					bh = DateUtil.formatDate("yyMM-dd-")
							+ (list.getTotalCount() + 1);
				}
			}
			
			//bh = td.getPnumber().lastIndexOf(arg0)
		}
		   
		deposit("pnumber_create", bh);
		loadListSession();
		return ADD;
	}

	public String save() {
		/*if (getCurrentUser() != null
				&& getCurrentUser().getToWrite() != null
				&& (getCurrentUser().getToWrite().equals("0") || getCurrentUser()
						.getToWrite() == null)) {
			result = "对不起，您没有添加的权限，请联系管理员开通添加权限!";
			return "returnlist";
		}*/
		entity.setAddTime(new Date());
		entity.setState("1");
		productService.save(entity);
		result = "添加成功!";
		if (getCurrentAdmin() != null)
			saveLog("产品:" + entity.getName(), result, CommonConst.LOGSAVE,
					CommonConst.LOGTYPEBYADMIN);
		else
			saveLog("产品:" + entity.getName(), result, CommonConst.LOGSAVE,
					CommonConst.LOGTYPEBYUSER);
		if (StringUtil.isNotBlank(isAgain) && isAgain.equals("1"))
			return add();
		isNewsClient(entity.getClient());
		return "returnlist";
	}

	public String update() {
		/*if (getCurrentUser() != null
				&& getCurrentUser().getToUpdate() != null
				&& (getCurrentUser().getToUpdate().equals("0") || getCurrentUser()
						.getToUpdate() == null)) {
			result = "对不起，您没有修改的权限，请联系管理员开通修改权限!";
			return "returnlist";
		}*/
		TdProduct tp = new TdProduct();
		productService.load(tp, entity.getProductId());
		ObjectUtil.extend(tp, entity);
		productService.update(tp);
		result = "修改成功!";
		if (getCurrentAdmin() != null)
			saveLog("产品:" + entity.getName(), result, CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYADMIN);
		else
			saveLog("产品:" + entity.getName(), result, CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYUSER);
		return "returnlist";
	}

	public String del() {
		/*if (getCurrentUser() != null
				&& getCurrentUser().getToDelete() != null
				&& (getCurrentUser().getToDelete().equals("0") || getCurrentUser()
						.getToDelete() == null)) {
			result = "对不起，您没有删除的权限，请联系管理员开通删除权限!";
			return "returnlist";
		}*/
		productService.load(entity, entity.getProductId());
		entity.setState("3");
		productService.update(entity);
		result = "删除成功!";
		if (getCurrentAdmin() != null)
			saveLog("产品:" + entity.getName(), result, CommonConst.LOGDEL,
					CommonConst.LOGTYPEBYADMIN);
		else
			saveLog("产品:" + entity.getName(), result, CommonConst.LOGDEL,
					CommonConst.LOGTYPEBYUSER);
		TdRecycle tr = new TdRecycle();
		tr.setBelongId(entity.getProductId());
		tr.setName(getCurrentAdmin() == null ? getCurrentUser().getName()
				: getCurrentAdmin().getName());
		tr.setDelTime(new Date());
		baseService.save(tr);
		entity = new TdProduct();
		return "returnlist";
	}

	private void loadListSession() {
		TdData td = new TdData();
		td.setIsRoot("0");
		List<TdData> list = baseService.findByExample(td);
		int session_count = 0;
		for (TdData t : list) {
			if (getSession().getAttribute(t.getAlias() + "List") == null)
				getSession().setAttribute(t.getAlias() + "List",
						getDataByBelongId(t.getDataId()));
		}
	}

	private Map getDataByBelongId(int belongId) {
		Map<Integer, String> map = new HashMap<Integer, String>();
		DetachedCriteria dc = DetachedCriteria.forClass(TdData.class);
		dc.add(Restrictions.eq("belongId", belongId));
		List<TdData> dlist = baseService.findAllByCriteria(dc);
		for (TdData t : dlist)
			map.put(t.getDataId(), t.getName());
		return map;
	}

	private void isNewsClient(String name) {
		TdClient td = new TdClient();
		td.setName(name);
		td.setState("1");
		if (baseService.findByExample(td).isEmpty())
			deposit("clientName", name);
	}

	private Map getDataByName(String name) {
		Map<Integer, String> map = new HashMap<Integer, String>();
		TdData td = new TdData();
		td.setName(name);
		td.setIsRoot("0");
		List<TdData> l = baseService.findByExample(td);
		if (!l.isEmpty()) {
			DetachedCriteria dc = DetachedCriteria.forClass(TdData.class);
			dc.add(Restrictions.eq("belongId", l.get(0).getDataId()));
			List<TdData> dlist = baseService.findAllByCriteria(dc);
			for (TdData t : dlist)
				map.put(t.getDataId(), t.getName());
			return map;
		}
		return null;
	}

	public String marked() {
		productService.load(entity, entity.getProductId());
		entity.setMarked(StringUtil.isBlank(entity.getMarked()) ? "1" : entity
				.getMarked().equals("1") ? "0" : "1");
		productService.update(entity);
		result = entity.getMarked();
		if (getCurrentAdmin() != null)
			saveLog("产品:" + entity.getName(), result.equals("1") ? "添加标注"
					: "取消标注", CommonConst.LOGUPDATE, CommonConst.LOGTYPEBYADMIN);
		else
			saveLog("产品:" + entity.getName(), result.equals("1") ? "添加标注"
					: "取消标注", CommonConst.LOGUPDATE, CommonConst.LOGTYPEBYUSER);
		return JSON;
	}

	public String expExcel() {
		// 第一步，创建一个webbook，对应一个Excel文件
		HSSFWorkbook wb = new HSSFWorkbook();
		// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
		HSSFSheet sheet = wb.createSheet("产品列表表一");
		// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
		HSSFRow row = sheet.createRow((int) 0);
		// 第四步，创建单元格，并设置值表头 设置表头居中
		HSSFCellStyle style = wb.createCellStyle();
		style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
		sheet.setColumnWidth((short) 0, (short) 3000); // 第一个参数代表列id(从0开始),第2个参数代表宽度值
		sheet.setColumnWidth((short) 1, (short) 3000);
		sheet.setColumnWidth((short) 2, (short) 3500);
		sheet.setColumnWidth((short) 4, (short) 3000);
		sheet.setColumnWidth((short) 11, (short) 3000);
		sheet.setColumnWidth((short) 14, (short) 3000);
		sheet.setColumnWidth((short) 15, (short) 3000);
		HSSFCell cell = row.createCell((short) 0);
		cell.setCellValue("编号");
		cell.setCellStyle(style);
		cell = row.createCell((short) 1);
		cell.setCellValue("名称");
		cell.setCellStyle(style);
		cell = row.createCell((short) 2);
		cell.setCellValue("规格(宽*高)");
		cell.setCellStyle(style);
		cell = row.createCell((short) 3);
		cell.setCellValue("门高");
		cell.setCellStyle(style);
		cell = row.createCell((short) 4);
		cell.setCellValue("门面款式");
		cell.setCellStyle(style);
		cell = row.createCell((short) 5);
		cell.setCellValue("开门方向");
		cell.setCellStyle(style);
		cell = row.createCell((short) 6);
		cell.setCellValue("门框");
		cell.setCellStyle(style);
		cell = row.createCell((short) 7);
		cell.setCellValue("锁具");
		cell.setCellStyle(style);
		cell = row.createCell((short) 8);
		cell.setCellValue("数量");
		cell.setCellStyle(style);
		cell = row.createCell((short) 9);
		cell.setCellValue("气窗");
		cell.setCellStyle(style);
		cell = row.createCell((short) 10);
		cell.setCellValue("拉手");
		cell.setCellStyle(style);
		cell = row.createCell((short) 11);
		cell.setCellValue("颜色");
		cell.setCellStyle(style);
		cell = row.createCell((short) 12);
		cell.setCellValue("备注");
		cell.setCellStyle(style);
		cell = row.createCell((short) 13);
		cell.setCellValue("客户");
		cell.setCellStyle(style);
		cell = row.createCell((short) 14);
		cell.setCellValue("定货日期");
		cell.setCellStyle(style);
		cell = row.createCell((short) 15);
		cell.setCellValue("交货日期");
		cell.setCellStyle(style);
		cell = row.createCell((short) 16);

		// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
		DetachedCriteria dc = DetachedCriteria.forClass(entityClass);
		if (StringUtil.isNotBlank(searchKey)) {
			dc.add(Restrictions.or(Restrictions.or(
					Restrictions.like("name", searchKey, MatchMode.ANYWHERE),
					Restrictions.like("lsqc", searchKey, MatchMode.ANYWHERE)),
					Restrictions.or(Restrictions.like("client", searchKey,
							MatchMode.ANYWHERE), Restrictions.like("pnumber",
							searchKey, MatchMode.ANYWHERE))));
		}
		if (StringUtil.isNotBlank(dd1) && StringUtil.isNotBlank(dd2)) {
			
			dc.add(Restrictions.between(entity.getPace().equals("发货")?"fhTime":s_time, DateUtil.strToDate(dd1),
					DateUtil.strToDate(dd2)));
		} else if (StringUtil.isNotBlank(dd1)) {
			dc.add(Restrictions.between(entity.getPace().equals("发货")?"fhTime":s_time, DateUtil.strToDate(dd1),
					new Date()));
		} else if (StringUtil.isNotBlank(dd2)) {
			dc.add(Restrictions.between(entity.getPace().equals("发货")?"fhTime":s_time,
					DateUtil.getDateStart(DateUtil.strToDate(dd2)),
					DateUtil.getDateEnd(DateUtil.strToDate(dd2))));
		} else {

		}
		if(StringUtil.isNotBlank(entity.getPace())){
			dc.add(Restrictions.eq("pace", entity.getPace()));
		}
		if (StringUtil.isNotBlank(isMarked)) {
			if (isMarked.equals("1")) {
				dc.add(Restrictions.eq("marked", "1"));
			}
			if (isMarked.equals("2")) {
				dc.add(Restrictions.or(Restrictions.isNull("marked"),
						Restrictions.eq("marked", "0")));
			}
		}
		if (StringUtil.isNotBlank(order_type)) {
			if (order_type.equals("addTimedesc"))
				dc.addOrder(Order.desc("addTime"));
			if (order_type.equals("bhasc"))
				dc.addOrder(Order.asc("pnumber"));
			if (order_type.equals("bhdesc"))
				dc.addOrder(Order.desc("pnumber"));
			if (order_type.equals("mcasc"))
				dc.addOrder(Order.asc("name"));
			if (order_type.equals("mcasc"))
				dc.addOrder(Order.desc("name"));
			if (order_type.equals("khasc"))
				dc.addOrder(Order.asc("client"));
			if (order_type.equals("khdesc"))
				dc.addOrder(Order.desc("client"));
			if (order_type.equals("paceasc"))
				dc.addOrder(Order.asc("pace"));
			if (order_type.equals("pacedesc"))
				dc.addOrder(Order.desc("pace"));
		} else {
			dc.addOrder(Order.desc("addTime"));
		}
		dc.add(Restrictions.eq("state", "1"));
		List list = productService.findAllByCriteria(dc);

		for (int i = 0; i < list.size(); i++) {
			row = sheet.createRow((int) i + 1);
			TdProduct tc = (TdProduct) list.get(i);
			// 第四步，创建单元格，并设置值
			row.createCell((short) 0).setCellValue(tc.getPnumber());
			row.createCell((short) 1).setCellValue(tc.getName());
			row.createCell((short) 2).setCellValue(
					tc.getPwidth() + " * " + tc.getPheight());
			row.createCell((short) 3).setCellValue(tc.getHeight());
			row.createCell((short) 4).setCellValue(tc.getProdType());
			row.createCell((short) 5).setCellValue(tc.getDirection());
			row.createCell((short) 6).setCellValue(tc.getDoorframe());
			row.createCell((short) 7).setCellValue(tc.getLocks());
			row.createCell((short) 8).setCellValue(tc.getProCount());
			String ls = "";
			if(tc.getHeight()!=0){
				if(StringUtil.isNotBlank(tc.getLsqc())){
					ls = tc.getLsqc();
				}else{
					ls =  "栏栅气窗";
				}
			}
			else
				ls = "无";
			row.createCell((short) 9).setCellValue(ls);
			row.createCell((short) 10).setCellValue(tc.getHandle());
			row.createCell((short) 11).setCellValue(tc.getColor());
			row.createCell((short) 12).setCellValue(tc.getRemarks());
			row.createCell((short) 13).setCellValue(tc.getClient());
			row.createCell((short) 14).setCellValue(
					tc.getOrderTime() == null ? "" : new SimpleDateFormat(
							"yyyy-mm-dd").format(tc.getOrderTime()));
			row.createCell((short) 15).setCellValue(
					tc.getDeliveryTime() == null ? "" : new SimpleDateFormat(
							"yyyy-mm-dd").format(tc.getDeliveryTime()));
			
		}
		// 第六步，将文件存到指定位置
		String path = getRequest().getRealPath("excel-temp");
		File dir = new File(path);
		if (!dir.exists())
			dir.mkdirs();
		try {
			FileOutputStream fout = new FileOutputStream(path + "/products.xls");
			wb.write(fout);
			fout.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		result = "http://localhost:8080/excel-temp/" + "products.xls";
		return JSON;
	}
	public String pace(){
		productService.load(entity, entity.getProductId());
		TdData td = new TdData();
		td.setIsRoot("0");
		td.setAlias("pace");
		List<TdData> list = baseService.findByExample(td);
		if(!list.isEmpty())
			getSession().setAttribute("pageList",
					getDataByBelongId(list.get(0).getDataId()));
		return "pace";
	}
	public String updatePace(){
		TdProduct tp = new TdProduct();
		productService.load(tp, entity.getProductId());
		tp.setPace(entity.getPace());
		if(tp.getPace().equals("发货"))
			tp.setFhTime(new Date());
		else
			tp.setFhTime(null);
		productService.update(tp);
		result = "修改成功!";
		if (getCurrentAdmin() != null)
			saveLog("产品进度:" + entity.getPnumber(), result+",修改后进度为："+tp.getPace(), CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYADMIN);
		else
			saveLog("产品进度:" + entity.getName(), result+",修改后进度为："+tp.getPace(), CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYUSER);
		return JSON;
	}
	public String updateMmlldbs(){
		TdProduct tp = new TdProduct();
		productService.load(tp, entity.getProductId());
		tp.setMmlldbs(StringUtil.isBlank(tp.getMmlldbs())?"1":"");
		productService.update(tp);
		result = tp.getMmlldbs();
		if (getCurrentAdmin() != null)
			saveLog("门面领料单标识", result+",修改后为："+tp.getMmlldbs(), CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYADMIN);
		else
			saveLog("门面领料单标识" ,result+",修改后为："+tp.getMmlldbs(), CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYUSER);
		return JSON;
	}
	public String updateZplldbs(){
		TdProduct tp = new TdProduct();
		productService.load(tp, entity.getProductId());
		if(StringUtil.isNotBlank(zplldbs) && zplldbs.equals("jl")){
			tp.setZplldjlbs(StringUtil.isBlank(tp.getZplldjlbs())?"1":"");
			result = tp.getZplldjlbs();
		}
		if(StringUtil.isNotBlank(zplldbs) && zplldbs.equals("sj")){
			tp.setZplldsjbs(StringUtil.isBlank(tp.getZplldsjbs())?"1":"");
			result = tp.getZplldsjbs();
		}
		if(StringUtil.isNotBlank(zplldbs) && zplldbs.equals("ml")){
			tp.setZplldmlbs(StringUtil.isBlank(tp.getZplldmlbs())?"1":"");
			result = tp.getZplldmlbs();
		}
		if(StringUtil.isNotBlank(zplldbs) && zplldbs.equals("my")){
			tp.setZplldmybs(StringUtil.isBlank(tp.getZplldmybs())?"1":"");
			result = tp.getZplldmybs();
		}
		if(StringUtil.isNotBlank(zplldbs) && zplldbs.equals("cx")){
			tp.setZplldcxbs(StringUtil.isBlank(tp.getZplldcxbs())?"1":"");
			result = tp.getZplldcxbs();
		}
		productService.update(tp);
		if (getCurrentAdmin() != null)
			saveLog("门面领料单标识:"+(zplldbs.equals("jl")?"铰链":zplldbs.equals("sj")?"锁具":zplldbs.equals("ml")?"门铃":zplldbs.equals("my")?"猫眼":zplldbs.equals("cx")?"插销":""), result+",修改后为："+tp.getMmlldbs(), CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYADMIN);
		else
			saveLog("门面领料单标识:"+(zplldbs.equals("jl")?"铰链":zplldbs.equals("sj")?"锁具":zplldbs.equals("ml")?"门铃":zplldbs.equals("my")?"猫眼":zplldbs.equals("cx")?"插销":"") ,result+",修改后为："+tp.getMmlldbs(), CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYUSER);
		return JSON;
	}
	public String updateZplldbz(){
		TdProduct tp = new TdProduct();
		productService.load(tp, entity.getProductId());
		tp.setZplldbz(entity.getZplldbz());
		productService.update(tp);
		result = "修改成功!";
		if (getCurrentAdmin() != null)
			saveLog("装配领料单备注", result+",修改后为："+tp.getZplldbz(), CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYADMIN);
		else
			saveLog("装配领料单备注" ,result+",修改后为："+tp.getZplldbz(), CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYUSER);
		return JSON;
	}
	public String updateMmlldbz(){
		TdProduct tp = new TdProduct();
		productService.load(tp, entity.getProductId());
		tp.setMmlldbz(entity.getMmlldbz());
		productService.update(tp);
		result = "修改成功!";
		if (getCurrentAdmin() != null)
			saveLog("门面领料单备注", result+",修改后为："+tp.getMmlldbz(), CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYADMIN);
		else
			saveLog("门面领料单备注" ,result+",修改后为："+tp.getMmlldbz(), CommonConst.LOGUPDATE,
					CommonConst.LOGTYPEBYUSER);
		return JSON;
	}
	public String getDd1() {
		return dd1;
	}

	public void setDd1(String dd1) {
		this.dd1 = dd1;
	}

	public String getDd2() {
		return dd2;
	}

	public void setDd2(String dd2) {
		this.dd2 = dd2;
	}

	public String getS_time() {
		return s_time;
	}

	public void setS_time(String s_time) {
		this.s_time = s_time;
	}

	public String getSearchKey() {
		return searchKey;
	}

	public void setSearchKey(String searchKey) {
		this.searchKey = searchKey;
	}

	public String getOrder_type() {
		return order_type;
	}

	public void setOrder_type(String order_type) {
		this.order_type = order_type;
	}

	public String getIsMarked() {
		return isMarked;
	}

	public void setIsMarked(String isMarked) {
		this.isMarked = isMarked;
	}

	public String getProType() {
		return proType;
	}

	public void setProType(String proType) {
		this.proType = proType;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getIslist2() {
		return islist2;
	}

	public void setIslist2(String islist2) {
		this.islist2 = islist2;
	}

	public String getPageType() {
		return pageType;
	}

	public void setPageType(String pageType) {
		this.pageType = pageType;
	}

	public String getLsqcName() {
		return lsqcName;
	}

	public void setLsqcName(String lsqcName) {
		this.lsqcName = lsqcName;
	}

}
